This is the Markdown document with the responses to the Problem Set 3

Initialization code

setwd("~/Google Drive/Udacity/Data_Analysis_with_R/")
library(ggplot2)
data(diamonds)

Problem 3.1 > Diamonds

How many observations are in the data set?

dim(diamonds)
## [1] 53940    10

Response: 53940


How many variables are in the data Set?

dim(diamonds)
## [1] 53940    10
names(diamonds)
##  [1] "carat"   "cut"     "color"   "clarity" "depth"   "table"   "price"  
##  [8] "x"       "y"       "z"

Response: 10


How many ordered factors are in the data Set?

str(diamonds)
## 'data.frame':    53940 obs. of  10 variables:
##  $ carat  : num  0.23 0.21 0.23 0.29 0.31 0.24 0.24 0.26 0.22 0.23 ...
##  $ cut    : Ord.factor w/ 5 levels "Fair"<"Good"<..: 5 4 2 4 2 3 3 3 1 3 ...
##  $ color  : Ord.factor w/ 7 levels "D"<"E"<"F"<"G"<..: 2 2 2 6 7 7 6 5 2 5 ...
##  $ clarity: Ord.factor w/ 8 levels "I1"<"SI2"<"SI1"<..: 2 3 5 4 2 6 7 3 4 5 ...
##  $ depth  : num  61.5 59.8 56.9 62.4 63.3 62.8 62.3 61.9 65.1 59.4 ...
##  $ table  : num  55 61 65 58 58 57 57 55 61 61 ...
##  $ price  : int  326 326 327 334 335 336 336 337 337 338 ...
##  $ x      : num  3.95 3.89 4.05 4.2 4.34 3.94 3.95 4.07 3.87 4 ...
##  $ y      : num  3.98 3.84 4.07 4.23 4.35 3.96 3.98 4.11 3.78 4.05 ...
##  $ z      : num  2.43 2.31 2.31 2.63 2.75 2.48 2.47 2.53 2.49 2.39 ...

Response: 3


What letter represents the best color for a diamond?

levels(diamonds$color)
## [1] "D" "E" "F" "G" "H" "I" "J"

Response: D

Problem 3.2 > Price Histogram

Create a histogram of the price of all the diamonds in the diamond data set.

qplot(x = price, data = diamonds, binwidth = 150, 
      color = I('black'), fill = I('#D9D9D9')) +
  scale_x_continuous(breaks = seq(0, 20000, 2000))

Problem 3.3 > Price Histogram Summary

Describe the shape and center of the price distribution. Include summary statistics like mean and median

summary(diamonds)
##      carat               cut        color        clarity     
##  Min.   :0.2000   Fair     : 1610   D: 6775   SI1    :13065  
##  1st Qu.:0.4000   Good     : 4906   E: 9797   VS2    :12258  
##  Median :0.7000   Very Good:12082   F: 9542   SI2    : 9194  
##  Mean   :0.7979   Premium  :13791   G:11292   VS1    : 8171  
##  3rd Qu.:1.0400   Ideal    :21551   H: 8304   VVS2   : 5066  
##  Max.   :5.0100                     I: 5422   VVS1   : 3655  
##                                     J: 2808   (Other): 2531  
##      depth           table           price             x         
##  Min.   :43.00   Min.   :43.00   Min.   :  326   Min.   : 0.000  
##  1st Qu.:61.00   1st Qu.:56.00   1st Qu.:  950   1st Qu.: 4.710  
##  Median :61.80   Median :57.00   Median : 2401   Median : 5.700  
##  Mean   :61.75   Mean   :57.46   Mean   : 3933   Mean   : 5.731  
##  3rd Qu.:62.50   3rd Qu.:59.00   3rd Qu.: 5324   3rd Qu.: 6.540  
##  Max.   :79.00   Max.   :95.00   Max.   :18823   Max.   :10.740  
##                                                                  
##        y                z         
##  Min.   : 0.000   Min.   : 0.000  
##  1st Qu.: 4.720   1st Qu.: 2.910  
##  Median : 5.710   Median : 3.530  
##  Mean   : 5.735   Mean   : 3.539  
##  3rd Qu.: 6.540   3rd Qu.: 4.040  
##  Max.   :58.900   Max.   :31.800  
## 

Response: The Price distribution presents a shape with a long tail. The 50% of the prices are included between 950$ (Q1) and 5324$ (Q3). The median price is 2401\(, lower than the mean, that is 3933\), mainly due to the long tail shape, that moves the mean compared to the median.

Problem 3.4 > Diamond Counts

How many diamonds cost less than $500?

dim(subset(diamonds, diamonds$price < 500))
## [1] 1729   10

Response: 1729


How many diamonds cost less than $250?

dim(subset(diamonds, diamonds$price < 250))
## [1]  0 10

Response: 0


How many diamonds cost $15000 or more?

dim(subset(diamonds, diamonds$price >= 15000))
## [1] 1656   10

Response: 1656

Problem 3.5 > Cheaper Diamonds

Explore the largest peak in the price histogram you created earlier. Try limiting the x-axis, altering the bin width, and setting different breaks on the x-axis.

qplot(x = price, data = diamonds, binwidth = 25, 
      color = I('black'), fill = I('#D9D9D9')) +
  scale_x_continuous(limits = c(200, 1500),
                     breaks = seq(0, 1500, 100))

Problem 3.6 > Price by Cut Histograms

Break out the histogram of diamond prices by cut. You should have five histograms in separate panels on your resulting plot.

qplot(x = price, data = diamonds, binwidth = 150,
      xlab = 'Price of diamonds',
      ylab = 'Number of diamonds',
      color = I('black'), fill = I('#D9D9D9')) +
  scale_x_continuous(breaks = seq(0, 20000, 2000)) +
  facet_wrap(~cut)

Problem 3.7 Price by cut

Answer the questions below. Check more than one option if there aare ties.

Which cut has the highest priced diamond?

by(diamonds$price, diamonds$cut, max)
## diamonds$cut: Fair
## [1] 18574
## -------------------------------------------------------- 
## diamonds$cut: Good
## [1] 18788
## -------------------------------------------------------- 
## diamonds$cut: Very Good
## [1] 18818
## -------------------------------------------------------- 
## diamonds$cut: Premium
## [1] 18823
## -------------------------------------------------------- 
## diamonds$cut: Ideal
## [1] 18806

Response: Premium

Which cut has the lowest priced diamond?

by(diamonds$price, diamonds$cut, min)
## diamonds$cut: Fair
## [1] 337
## -------------------------------------------------------- 
## diamonds$cut: Good
## [1] 327
## -------------------------------------------------------- 
## diamonds$cut: Very Good
## [1] 336
## -------------------------------------------------------- 
## diamonds$cut: Premium
## [1] 326
## -------------------------------------------------------- 
## diamonds$cut: Ideal
## [1] 326

Response: Premium & Ideal

Which cut has the lowest median price?

by(diamonds$price, diamonds$cut, summary)
## diamonds$cut: Fair
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     337    2050    3282    4359    5206   18570 
## -------------------------------------------------------- 
## diamonds$cut: Good
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     327    1145    3050    3929    5028   18790 
## -------------------------------------------------------- 
## diamonds$cut: Very Good
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     336     912    2648    3982    5373   18820 
## -------------------------------------------------------- 
## diamonds$cut: Premium
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     326    1046    3185    4584    6296   18820 
## -------------------------------------------------------- 
## diamonds$cut: Ideal
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     326     878    1810    3458    4678   18810

Response: Ideal

Problem 3.8 > Scales and Multiple Histograms

Run the code below in R Studio to generate the histogram as a reminder.

qplot(x = price, data = diamonds) + facet_wrap(~cut)
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.

In the last exercise, we looked at the summary statistics for diamond price by cut. If we look at the output table, the median and quartiles are reasonably close to each other. This means the distributions should be somewhat similar, but the histograms we created don’t show that.

The ‘Fair’ and ‘Good’ diamonds appear to have different distributions compared to the better cut diamonds. They seem somewhat uniform on the left with long tails on the right.

Look up the documentation for facet_wrap in R Studio. Then, scroll back up and add a parameter to facet_wrap so that the y-axis in the histograms is not fixed. You want the y-axis to be different for each histogram.

qplot(x = price, data = diamonds, binwidth = 150,
      xlab = 'Price of diamonds',
      ylab = 'Number of diamonds',
      color = I('black'), fill = I('#D9D9D9')) +
  scale_x_continuous(breaks = seq(0, 20000, 2000)) + 
  facet_wrap(~cut, scales = "free_y")

Problem 3.9 > Price per Carat by Cut

Create a histogram of price per carat and facet it by cut. You can make adjustments to the code from the previous exercise to get started. Adjust the bin width and transform the scale of the x-axis using log10.

qplot(x = price/carat, 
      data = diamonds,
      binwidth = 0.05,
      xlab = 'Price per carat of diamonds (log10)',
      ylab = 'Number of diamonds',
      color = I('black'), fill = I('#D9D9D9')) + 
  scale_x_log10() + 
  facet_wrap(~cut, scales = "free_y")

Problem 3.10 > Price Box Plots

Investigate the price of diamonds using box plots, numerical summaries, and one of the following categorical variables: cut, clarity, or color.

by(diamonds$price, diamonds$color, summary)
## diamonds$color: D
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     357     911    1838    3170    4214   18690 
## -------------------------------------------------------- 
## diamonds$color: E
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     326     882    1739    3077    4003   18730 
## -------------------------------------------------------- 
## diamonds$color: F
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     342     982    2344    3725    4868   18790 
## -------------------------------------------------------- 
## diamonds$color: G
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     354     931    2242    3999    6048   18820 
## -------------------------------------------------------- 
## diamonds$color: H
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     337     984    3460    4487    5980   18800 
## -------------------------------------------------------- 
## diamonds$color: I
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     334    1120    3730    5092    7202   18820 
## -------------------------------------------------------- 
## diamonds$color: J
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     335    1860    4234    5324    7695   18710
qplot(x = color, y = price, 
      data = diamonds, 
      geom = 'boxplot') +
  coord_cartesian(ylim = c(0, 10000))

Problem 3.11 > Interquartile Range - IQR

What is the price range for the middle 50% of diamonds with color D?

summary(subset(diamonds, color == "D")$price)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     357     911    1838    3170    4214   18690

Response: 911 - 4214

What is the price range for the middle 50% of diamonds with color J?

summary(subset(diamonds, color == "J")$price)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     335    1860    4234    5324    7695   18710

Response: 1860 - 7695

What is the IQR for diamonds with the best color?

4214 - 911
## [1] 3303

Response: 3303

What is the IQR for diamonds with the best color?

7695 - 1860
## [1] 5835

Response: 5835

Problem 3.12 > Price per Carat Box Plots by Color

Investigate the price per carat of diamonds across the different colors of diamonds using boxplots.

qplot(x = color, y = price/carat, 
      data = diamonds,
      xlab = "Color: J (worst) to D (best)",
      geom = 'boxplot') +
  coord_cartesian(ylim = c(0, 6000))

Problem 3.13: > Carat Frequency Polygon

Investigate the weight of the diamonds (carat) using a frequency polygon. Use different bin widths to see how the frequency polygon changes.

What carat size has a count greater than 2000?

qplot(x = carat,
      data = diamonds, 
      binwidth = 0.01, geom = 'freqpoly') +
  scale_x_continuous(breaks = seq(0, 5, 0.1))

### Response: 0.3 & 1.01

Problem 3.14 > Data Wrangling with R

Data munging or data wrangling can take up much of a data scientist’s or data analyst’s time. There are two R packages that make these tasks easier in R: tidyr and dplyr. tidyr -a package that reshapes the layout of your data & dplyr - a package that helps you transform tidy, tabular data

Problem 3.15 > Gapminder Data

The Gapminder website contains over 500 data sets with information about the world’s population. Your task is to download a data set of your choice and create 2-5 plots that make use of the techniques from Lesson 3.

You might use a simple histogram, a boxplot split over a categorical variable, or a frequency polygon. The choice is yours!

library("tidyr")
library("dplyr")
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
bmi <- read.csv("BMImale.csv", sep = ";",check.names=FALSE)
bmiT <- gather(bmi, "Year", "bmi", 2:30)

NOTE: check.names=FALSE avoids putting an X in front of the header names

Boxplot for each year & all countries

qplot(x = Year, y = bmi, 
      data = bmiT,
      xlab = 'Body Mass Index',
      ylab = 'Number Young Men',
      geom = 'boxplot') +
  theme(axis.text.x = element_text(angle = 60, hjust = 1), legend.position="none")

### histogram faceted by year

qplot(x = bmi,
      data = bmiT, 
      binwidth = 0.1,
      xlab = 'Body Mass Index',
      ylab = 'Number Young Men',
      color = I('black'), fill = I('#D9D9D9')) +
  scale_x_continuous(breaks = seq(18, 34, 1)) + 
  facet_wrap(~Year, scales = "free_y")

### Frequency line

qplot(x = bmi,
      data = bmiT, 
      binwidth = 0.1, geom = 'freqpoly')

### Frequency line by country

qplot(x = bmi,
      data = bmiT, 
      binwidth = 0.5, geom = 'freqpoly', color = Country)

### Frequency line faceted by year

qplot(x = bmi,
      data = bmiT, 
      binwidth = 0.1, geom = 'freqpoly') + 
  facet_wrap(~Year, scales = "free_y")

### BMI summary by year

by(bmiT$bmi, bmiT$Year, summary)
## bmiT$Year: 1980
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.01   21.27   23.31   23.15   24.82   28.12 
## -------------------------------------------------------- 
## bmiT$Year: 1981
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.04   21.31   23.39   23.21   24.89   28.36 
## -------------------------------------------------------- 
## bmiT$Year: 1982
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.07   21.36   23.46   23.26   24.94   28.58 
## -------------------------------------------------------- 
## bmiT$Year: 1983
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.10   21.42   23.57   23.32   25.02   28.82 
## -------------------------------------------------------- 
## bmiT$Year: 1984
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.13   21.45   23.64   23.37   25.06   29.05 
## -------------------------------------------------------- 
## bmiT$Year: 1985
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.16   21.47   23.73   23.42   25.11   29.28 
## -------------------------------------------------------- 
## bmiT$Year: 1986
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.20   21.49   23.82   23.48   25.20   29.52 
## -------------------------------------------------------- 
## bmiT$Year: 1987
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.23   21.50   23.87   23.53   25.27   29.75 
## -------------------------------------------------------- 
## bmiT$Year: 1988
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.27   21.52   23.93   23.59   25.34   29.98 
## -------------------------------------------------------- 
## bmiT$Year: 1989
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.31   21.55   24.03   23.65   25.37   30.20 
## -------------------------------------------------------- 
## bmiT$Year: 1990
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.35   21.57   24.14   23.71   25.39   30.42 
## -------------------------------------------------------- 
## bmiT$Year: 1991
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.40   21.60   24.20   23.76   25.42   30.64 
## -------------------------------------------------------- 
## bmiT$Year: 1992
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.45   21.65   24.19   23.82   25.48   30.85 
## -------------------------------------------------------- 
## bmiT$Year: 1993
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.51   21.74   24.27   23.88   25.54   31.04 
## -------------------------------------------------------- 
## bmiT$Year: 1994
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.59   21.76   24.36   23.94   25.62   31.23 
## -------------------------------------------------------- 
## bmiT$Year: 1995
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.67   21.83   24.41   24.00   25.70   31.41 
## -------------------------------------------------------- 
## bmiT$Year: 1996
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.71   21.89   24.42   24.07   25.78   31.59 
## -------------------------------------------------------- 
## bmiT$Year: 1997
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.74   21.94   24.50   24.14   25.85   31.77 
## -------------------------------------------------------- 
## bmiT$Year: 1998
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.77   22.00   24.49   24.21   25.94   31.95 
## -------------------------------------------------------- 
## bmiT$Year: 1999
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.80   22.04   24.61   24.29   26.01   32.13 
## -------------------------------------------------------- 
## bmiT$Year: 2000
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.83   22.12   24.66   24.36   26.09   32.32 
## -------------------------------------------------------- 
## bmiT$Year: 2001
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.86   22.22   24.73   24.44   26.19   32.51 
## -------------------------------------------------------- 
## bmiT$Year: 2002
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.84   22.29   24.81   24.52   26.30   32.70 
## -------------------------------------------------------- 
## bmiT$Year: 2003
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.81   22.37   24.89   24.61   26.38   32.90 
## -------------------------------------------------------- 
## bmiT$Year: 2004
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.79   22.45   25.00   24.70   26.47   33.10 
## -------------------------------------------------------- 
## bmiT$Year: 2005
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.79   22.54   25.11   24.79   26.53   33.30 
## -------------------------------------------------------- 
## bmiT$Year: 2006
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.80   22.63   25.24   24.89   26.59   33.49 
## -------------------------------------------------------- 
## bmiT$Year: 2007
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.83   22.73   25.36   24.99   26.66   33.69 
## -------------------------------------------------------- 
## bmiT$Year: 2008
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.87   22.83   25.50   25.10   26.82   33.90

BMI summary by country

by(bmiT$bmi, bmiT$Country, summary)
## bmiT$Country: Afghanistan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.58   20.63   20.98   21.01   21.38   21.49 
## -------------------------------------------------------- 
## bmiT$Country: Albania
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.21   25.27   25.31   25.51   25.67   26.45 
## -------------------------------------------------------- 
## bmiT$Country: Algeria
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.26   22.84   23.32   23.36   23.86   24.60 
## -------------------------------------------------------- 
## bmiT$Country: Andorra
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.67   25.93   26.37   26.47   26.92   27.63 
## -------------------------------------------------------- 
## bmiT$Country: Angola
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.93   20.98   21.15   21.28   21.44   22.25 
## -------------------------------------------------------- 
## bmiT$Country: Antigua and Barbuda
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.31   23.94   24.61   24.53   25.06   25.77 
## -------------------------------------------------------- 
## bmiT$Country: Argentina
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.38   25.79   26.28   26.35   26.96   27.50 
## -------------------------------------------------------- 
## bmiT$Country: Armenia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.82   24.03   24.13   24.25   24.27   25.36 
## -------------------------------------------------------- 
## bmiT$Country: Australia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.93   25.51   26.20   26.19   26.84   27.56 
## -------------------------------------------------------- 
## bmiT$Country: Austria
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.84   25.15   25.57   25.57   25.94   26.47 
## -------------------------------------------------------- 
## bmiT$Country: Azerbaijan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.47   24.56   24.69   24.76   24.82   25.65 
## -------------------------------------------------------- 
## bmiT$Country: Bahamas
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.21   25.03   25.66   25.70   26.39   27.25 
## -------------------------------------------------------- 
## bmiT$Country: Bahrain
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.98   24.75   25.72   25.79   26.80   27.84 
## -------------------------------------------------------- 
## bmiT$Country: Bangladesh
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.10   20.14   20.21   20.25   20.33   20.52 
## -------------------------------------------------------- 
## bmiT$Country: Barbados
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.36   24.78   25.14   25.25   25.69   26.38 
## -------------------------------------------------------- 
## bmiT$Country: Belarus
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.91   24.94   25.10   25.21   25.32   26.16 
## -------------------------------------------------------- 
## bmiT$Country: Belgium
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.10   25.32   25.78   25.82   26.24   26.76 
## -------------------------------------------------------- 
## bmiT$Country: Belize
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.54   24.96   25.54   25.62   26.19   27.02 
## -------------------------------------------------------- 
## bmiT$Country: Benin
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.81   21.08   21.40   21.49   21.87   22.42 
## -------------------------------------------------------- 
## bmiT$Country: Bermuda
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.08   25.94   26.76   26.75   27.56   28.42 
## -------------------------------------------------------- 
## bmiT$Country: Bhutan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.75   21.79   21.90   22.06   22.27   22.82 
## -------------------------------------------------------- 
## bmiT$Country: Bolivia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.00   23.21   23.56   23.63   24.02   24.43 
## -------------------------------------------------------- 
## bmiT$Country: Bosnia and Herzegovina
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.07   25.33   25.42   25.56   25.71   26.61 
## -------------------------------------------------------- 
## bmiT$Country: Botswana
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.54   19.90   20.59   20.62   21.20   22.13 
## -------------------------------------------------------- 
## bmiT$Country: Brazil
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.64   23.28   24.04   24.09   24.85   25.79 
## -------------------------------------------------------- 
## bmiT$Country: British Virgin Islands
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.74   24.13   25.04   25.27   26.42   27.31 
## -------------------------------------------------------- 
## bmiT$Country: Brunei
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.24   23.42   23.61   23.67   23.90   24.18 
## -------------------------------------------------------- 
## bmiT$Country: Bulgaria
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.29   25.67   25.78   25.81   25.90   26.54 
## -------------------------------------------------------- 
## bmiT$Country: Burkina Faso
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.03   20.25   20.46   20.53   20.76   21.27 
## -------------------------------------------------------- 
## bmiT$Country: Burundi
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.09   21.20   21.31   21.28   21.34   21.50 
## -------------------------------------------------------- 
## bmiT$Country: Cambodia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.70   19.81   20.00   20.09   20.31   20.80 
## -------------------------------------------------------- 
## bmiT$Country: Cameroon
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.79   22.36   22.56   22.66   22.98   23.68 
## -------------------------------------------------------- 
## bmiT$Country: Canada
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.24   25.85   26.50   26.44   27.06   27.45 
## -------------------------------------------------------- 
## bmiT$Country: Cape Verde
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.66   21.19   21.83   21.92   22.59   23.52 
## -------------------------------------------------------- 
## bmiT$Country: Central African Rep.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.78   20.81   20.86   20.87   20.92   20.99 
## -------------------------------------------------------- 
## bmiT$Country: Chad
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.23   20.38   20.63   20.69   20.91   21.49 
## -------------------------------------------------------- 
## bmiT$Country: Chile
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.48   24.90   25.55   25.62   26.27   27.02 
## -------------------------------------------------------- 
## bmiT$Country: China
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.58   21.76   22.15   22.18   22.58   22.92 
## -------------------------------------------------------- 
## bmiT$Country: Colombia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.07   22.74   23.51   23.50   24.23   24.94 
## -------------------------------------------------------- 
## bmiT$Country: Comoros
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.98   21.25   21.60   21.53   21.76   22.06 
## -------------------------------------------------------- 
## bmiT$Country: Congo, Dem. Rep.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.79   19.90   20.49   20.34   20.68   20.75 
## -------------------------------------------------------- 
## bmiT$Country: Congo, Rep.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.64   21.05   21.22   21.24   21.42   21.87 
## -------------------------------------------------------- 
## bmiT$Country: Cook Islands
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   26.20   27.87   29.40   29.40   30.92   32.67 
## -------------------------------------------------------- 
## bmiT$Country: Costa Rica
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.69   24.18   24.96   24.97   25.68   26.48 
## -------------------------------------------------------- 
## bmiT$Country: Cote d'Ivoire
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.13   21.44   21.71   21.77   22.09   22.56 
## -------------------------------------------------------- 
## bmiT$Country: Croatia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.29   25.50   25.59   25.74   25.94   26.60 
## -------------------------------------------------------- 
## bmiT$Country: Cuba
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.73   23.35   23.70   23.77   24.17   25.07 
## -------------------------------------------------------- 
## bmiT$Country: Cyprus
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.34   25.73   26.26   26.30   26.84   27.42 
## -------------------------------------------------------- 
## bmiT$Country: Czech Rep.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   26.31   26.62   26.93   27.00   27.35   27.91 
## -------------------------------------------------------- 
## bmiT$Country: Denmark
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.56   24.63   24.90   25.07   25.43   26.13 
## -------------------------------------------------------- 
## bmiT$Country: Djibouti
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.24   21.82   22.27   22.27   22.70   23.38 
## -------------------------------------------------------- 
## bmiT$Country: Dominica
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.32   22.82   23.54   23.48   24.12   24.57 
## -------------------------------------------------------- 
## bmiT$Country: Dominican Rep.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.93   23.27   23.67   23.81   24.26   25.20 
## -------------------------------------------------------- 
## bmiT$Country: Ecuador
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.79   24.11   24.59   24.61   25.02   25.59 
## -------------------------------------------------------- 
## bmiT$Country: Egypt
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.26   24.90   25.49   25.51   26.15   26.73 
## -------------------------------------------------------- 
## bmiT$Country: El Salvador
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.77   24.17   24.76   24.88   25.55   26.37 
## -------------------------------------------------------- 
## bmiT$Country: Equatorial Guinea
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.09   21.18   21.36   21.84   22.37   23.77 
## -------------------------------------------------------- 
## bmiT$Country: Eritrea
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.01   20.16   20.39   20.44   20.77   20.89 
## -------------------------------------------------------- 
## bmiT$Country: Estonia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.69   24.74   24.80   25.09   25.34   26.26 
## -------------------------------------------------------- 
## bmiT$Country: Ethiopia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.48   19.58   19.66   19.74   19.86   20.25 
## -------------------------------------------------------- 
## bmiT$Country: Fiji
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.28   23.28   24.29   24.35   25.39   26.53 
## -------------------------------------------------------- 
## bmiT$Country: Finland
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.46   25.61   25.85   25.93   26.15   26.73 
## -------------------------------------------------------- 
## bmiT$Country: France
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.71   24.88   25.13   25.18   25.43   25.85 
## -------------------------------------------------------- 
## bmiT$Country: French Polynesia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.42   26.79   28.24   28.18   29.56   30.87 
## -------------------------------------------------------- 
## bmiT$Country: Gabon
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.27   22.69   23.09   23.13   23.57   24.08 
## -------------------------------------------------------- 
## bmiT$Country: Gambia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.94   20.15   20.54   20.61   21.00   21.65 
## -------------------------------------------------------- 
## bmiT$Country: Georgia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.59   24.67   24.83   24.87   25.00   25.55 
## -------------------------------------------------------- 
## bmiT$Country: Germany
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.46   25.79   26.28   26.28   26.73   27.17 
## -------------------------------------------------------- 
## bmiT$Country: Ghana
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.01   21.17   21.56   21.70   22.16   22.84 
## -------------------------------------------------------- 
## bmiT$Country: Greece
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.81   25.01   25.35   25.42   25.74   26.34 
## -------------------------------------------------------- 
## bmiT$Country: Greenland
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.47   24.78   25.12   25.18   25.56   26.01 
## -------------------------------------------------------- 
## bmiT$Country: Grenada
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.27   23.62   24.05   24.11   24.56   25.18 
## -------------------------------------------------------- 
## bmiT$Country: Guatemala
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.19   23.65   24.14   24.19   24.73   25.30 
## -------------------------------------------------------- 
## bmiT$Country: Guinea
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.15   21.29   21.57   21.66   21.97   22.52 
## -------------------------------------------------------- 
## bmiT$Country: Guinea-Bissau
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.71   20.94   21.24   21.19   21.44   21.64 
## -------------------------------------------------------- 
## bmiT$Country: Guyana
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.71   22.76   22.91   23.07   23.42   23.68 
## -------------------------------------------------------- 
## bmiT$Country: Haiti
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.91   23.01   23.02   23.13   23.22   23.66 
## -------------------------------------------------------- 
## bmiT$Country: Honduras
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.13   23.54   24.02   24.06   24.55   25.11 
## -------------------------------------------------------- 
## bmiT$Country: Hong Kong, China
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.63   22.50   23.52   23.42   24.34   25.06 
## -------------------------------------------------------- 
## bmiT$Country: Hungary
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.28   25.76   26.05   26.10   26.40   27.12 
## -------------------------------------------------------- 
## bmiT$Country: Iceland
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.83   25.34   25.77   25.88   26.40   27.21 
## -------------------------------------------------------- 
## bmiT$Country: India
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.62   20.70   20.81   20.81   20.91   21.09 
## -------------------------------------------------------- 
## bmiT$Country: Indonesia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.86   20.18   20.67   20.73   21.22   21.86 
## -------------------------------------------------------- 
## bmiT$Country: Iran
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.16   23.71   24.30   24.28   24.91   25.31 
## -------------------------------------------------------- 
## bmiT$Country: Iraq
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.98   25.55   25.77   25.87   26.31   26.71 
## -------------------------------------------------------- 
## bmiT$Country: Ireland
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.81   25.98   26.38   26.54   27.07   27.65 
## -------------------------------------------------------- 
## bmiT$Country: Israel
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.77   25.10   25.62   25.76   26.38   27.13 
## -------------------------------------------------------- 
## bmiT$Country: Italy
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.41   25.46   25.70   25.77   26.00   26.48 
## -------------------------------------------------------- 
## bmiT$Country: Jamaica
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.33   22.53   22.89   23.00   23.40   24.00 
## -------------------------------------------------------- 
## bmiT$Country: Japan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.10   22.24   22.62   22.70   23.14   23.50 
## -------------------------------------------------------- 
## bmiT$Country: Jordan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.65   25.53   26.17   26.14   26.80   27.47 
## -------------------------------------------------------- 
## bmiT$Country: Kazakhstan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.57   24.89   25.00   25.12   25.19   26.29 
## -------------------------------------------------------- 
## bmiT$Country: Kenya
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.31   20.61   20.93   20.92   21.21   21.59 
## -------------------------------------------------------- 
## bmiT$Country: Kiribati
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.48   26.06   26.93   27.12   28.15   29.24 
## -------------------------------------------------------- 
## bmiT$Country: Korea, Dem. Rep.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.79   22.01   22.06   22.10   22.23   22.34 
## -------------------------------------------------------- 
## bmiT$Country: Korea, Rep.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.07   22.29   22.86   22.91   23.47   23.99 
## -------------------------------------------------------- 
## bmiT$Country: Kuwait
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.49   26.19   27.02   27.17   28.17   29.17 
## -------------------------------------------------------- 
## bmiT$Country: Kyrgyzstan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.21   24.31   24.44   24.42   24.52   24.75 
## -------------------------------------------------------- 
## bmiT$Country: Laos
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.60   19.84   20.10   20.19   20.51   21.08 
## -------------------------------------------------------- 
## bmiT$Country: Latvia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.12   25.23   25.32   25.47   25.56   26.46 
## -------------------------------------------------------- 
## bmiT$Country: Lebanon
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.88   24.69   25.51   25.55   26.48   27.20 
## -------------------------------------------------------- 
## bmiT$Country: Lesotho
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.58   20.65   20.76   20.95   21.15   21.90 
## -------------------------------------------------------- 
## bmiT$Country: Liberia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.13   21.33   21.41   21.47   21.65   21.90 
## -------------------------------------------------------- 
## bmiT$Country: Libya
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.40   25.03   25.53   25.51   25.99   26.54 
## -------------------------------------------------------- 
## bmiT$Country: Lithuania
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.82   25.96   25.98   26.08   26.06   26.86 
## -------------------------------------------------------- 
## bmiT$Country: Luxembourg
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.99   25.39   26.09   26.11   26.75   27.43 
## -------------------------------------------------------- 
## bmiT$Country: Macao, China
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.65   23.40   24.19   24.14   24.83   25.71 
## -------------------------------------------------------- 
## bmiT$Country: Macedonia, FYR
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.40   25.52   25.57   25.68   25.80   26.34 
## -------------------------------------------------------- 
## bmiT$Country: Madagascar
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.70   20.83   21.02   21.01   21.17   21.40 
## -------------------------------------------------------- 
## bmiT$Country: Malawi
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.79   20.90   21.00   21.19   21.45   22.03 
## -------------------------------------------------------- 
## bmiT$Country: Malaysia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.58   22.30   23.10   23.14   23.99   24.73 
## -------------------------------------------------------- 
## bmiT$Country: Maldives
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.44   21.04   21.72   21.73   22.39   23.22 
## -------------------------------------------------------- 
## bmiT$Country: Mali
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.28   20.42   20.73   20.83   21.16   21.79 
## -------------------------------------------------------- 
## bmiT$Country: Malta
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.70   25.97   26.50   26.58   27.16   27.68 
## -------------------------------------------------------- 
## bmiT$Country: Marshall Islands
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.67   25.81   27.14   27.05   28.24   29.37 
## -------------------------------------------------------- 
## bmiT$Country: Mauritania
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.85   21.16   21.54   21.62   22.05   22.62 
## -------------------------------------------------------- 
## bmiT$Country: Mauritius
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.99   22.73   23.61   23.57   24.36   25.16 
## -------------------------------------------------------- 
## bmiT$Country: Mexico
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.45   25.30   26.02   26.00   26.75   27.42 
## -------------------------------------------------------- 
## bmiT$Country: Micronesia, Fed. Sts.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.40   25.35   26.38   26.32   27.30   28.10 
## -------------------------------------------------------- 
## bmiT$Country: Moldova
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.87   24.02   24.42   24.35   24.66   24.73 
## -------------------------------------------------------- 
## bmiT$Country: Mongolia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.50   23.68   23.80   23.92   24.05   24.88 
## -------------------------------------------------------- 
## bmiT$Country: Montenegro
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.50   25.65   25.73   25.83   25.92   26.55 
## -------------------------------------------------------- 
## bmiT$Country: Morocco
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.22   23.76   24.40   24.39   24.97   25.63 
## -------------------------------------------------------- 
## bmiT$Country: Mozambique
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.43   20.51   20.79   20.92   21.19   21.94 
## -------------------------------------------------------- 
## bmiT$Country: Myanmar
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.66   19.95   20.09   20.29   20.57   21.45 
## -------------------------------------------------------- 
## bmiT$Country: Namibia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.08   21.20   21.32   21.53   21.75   22.65 
## -------------------------------------------------------- 
## bmiT$Country: Nauru
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   28.12   29.75   31.23   31.12   32.51   33.90 
## -------------------------------------------------------- 
## bmiT$Country: Nepal
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.63   20.65   20.70   20.72   20.76   20.96 
## -------------------------------------------------------- 
## bmiT$Country: Netherlands
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.13   24.31   24.77   24.87   25.36   26.02 
## -------------------------------------------------------- 
## bmiT$Country: Netherlands Antilles
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.62   25.36   25.98   26.10   26.89   27.71 
## -------------------------------------------------------- 
## bmiT$Country: New Zealand
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.26   25.71   26.20   26.32   26.87   27.77 
## -------------------------------------------------------- 
## bmiT$Country: Nicaragua
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.02   24.39   24.70   24.79   25.19   25.77 
## -------------------------------------------------------- 
## bmiT$Country: Niger
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.52   20.66   20.68   20.77   20.86   21.22 
## -------------------------------------------------------- 
## bmiT$Country: Nigeria
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.01   21.17   21.71   21.79   22.30   23.03 
## -------------------------------------------------------- 
## bmiT$Country: Norway
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.68   25.05   25.49   25.63   26.18   26.93 
## -------------------------------------------------------- 
## bmiT$Country: Oman
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.04   23.79   24.65   24.63   25.48   26.24 
## -------------------------------------------------------- 
## bmiT$Country: Pakistan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.54   21.62   21.79   21.84   22.04   22.30 
## -------------------------------------------------------- 
## bmiT$Country: Palau
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.42   26.38   27.70   27.76   29.05   30.38 
## -------------------------------------------------------- 
## bmiT$Country: Panama
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.53   24.13   24.69   24.78   25.44   26.27 
## -------------------------------------------------------- 
## bmiT$Country: Papua New Guinea
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.76   22.64   23.59   23.51   24.42   25.02 
## -------------------------------------------------------- 
## bmiT$Country: Paraguay
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.41   23.87   24.36   24.41   24.92   25.54 
## -------------------------------------------------------- 
## bmiT$Country: Peru
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.04   23.36   23.60   23.76   24.19   24.77 
## -------------------------------------------------------- 
## bmiT$Country: Philippines
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.22   21.61   22.04   22.04   22.47   22.87 
## -------------------------------------------------------- 
## bmiT$Country: Poland
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.14   25.28   25.49   25.67   26.02   26.67 
## -------------------------------------------------------- 
## bmiT$Country: Portugal
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.03   25.10   25.60   25.67   26.15   26.68 
## -------------------------------------------------------- 
## bmiT$Country: Puerto Rico
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.80   25.37   26.18   26.35   27.28   28.38 
## -------------------------------------------------------- 
## bmiT$Country: Qatar
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.96   25.52   26.18   26.34   27.12   28.13 
## -------------------------------------------------------- 
## bmiT$Country: Romania
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.63   24.67   24.75   24.81   24.83   25.41 
## -------------------------------------------------------- 
## bmiT$Country: Russia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.95   24.97   24.99   25.13   25.09   26.01 
## -------------------------------------------------------- 
## bmiT$Country: Rwanda
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.62   21.76   21.82   21.90   21.92   22.55 
## -------------------------------------------------------- 
## bmiT$Country: Saint Kitts and Nevis
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.26   25.82   26.46   26.58   27.32   28.23 
## -------------------------------------------------------- 
## bmiT$Country: Saint Lucia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.83   23.12   23.65   23.66   24.14   24.65 
## -------------------------------------------------------- 
## bmiT$Country: Saint Vincent and the Grenadines
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.07   23.48   24.02   24.08   24.57   25.44 
## -------------------------------------------------------- 
## bmiT$Country: Samoa
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.83   26.99   27.91   28.05   29.14   30.42 
## -------------------------------------------------------- 
## bmiT$Country: Sao Tome and Principe
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.27   21.61   21.99   22.15   22.64   23.51 
## -------------------------------------------------------- 
## bmiT$Country: Saudi Arabia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.02   25.70   26.34   26.40   27.10   27.88 
## -------------------------------------------------------- 
## bmiT$Country: Senegal
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.27   20.61   20.96   21.01   21.39   21.93 
## -------------------------------------------------------- 
## bmiT$Country: Serbia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.60   25.85   25.95   25.97   26.02   26.51 
## -------------------------------------------------------- 
## bmiT$Country: Seychelles
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.16   22.86   23.78   23.79   24.70   25.56 
## -------------------------------------------------------- 
## bmiT$Country: Sierra Leone
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.36   21.65   21.84   21.84   21.92   22.53 
## -------------------------------------------------------- 
## bmiT$Country: Singapore
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.57   23.00   23.47   23.37   23.78   23.84 
## -------------------------------------------------------- 
## bmiT$Country: Slovak Republic
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.55   25.82   26.05   26.12   26.38   26.93 
## -------------------------------------------------------- 
## bmiT$Country: Slovenia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.70   25.96   26.20   26.38   26.78   27.44 
## -------------------------------------------------------- 
## bmiT$Country: Solomon Islands
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.99   24.77   25.65   25.62   26.48   27.16 
## -------------------------------------------------------- 
## bmiT$Country: Somalia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.93   21.16   21.42   21.40   21.60   21.97 
## -------------------------------------------------------- 
## bmiT$Country: South Africa
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.14   23.38   23.77   24.22   24.78   26.86 
## -------------------------------------------------------- 
## bmiT$Country: Spain
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.34   25.53   26.04   26.18   26.72   27.50 
## -------------------------------------------------------- 
## bmiT$Country: Sri Lanka
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.38   20.71   21.03   21.10   21.52   21.97 
## -------------------------------------------------------- 
## bmiT$Country: Sudan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.72   20.91   21.18   21.32   21.66   22.40 
## -------------------------------------------------------- 
## bmiT$Country: Suriname
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.30   23.64   24.07   24.20   24.68   25.50 
## -------------------------------------------------------- 
## bmiT$Country: Swaziland
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.41   21.63   21.95   22.06   22.37   23.17 
## -------------------------------------------------------- 
## bmiT$Country: Sweden
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.72   25.00   25.38   25.44   25.83   26.38 
## -------------------------------------------------------- 
## bmiT$Country: Switzerland
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.16   25.32   25.58   25.61   25.85   26.20 
## -------------------------------------------------------- 
## bmiT$Country: Syria
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.35   24.99   25.52   25.63   26.32   26.92 
## -------------------------------------------------------- 
## bmiT$Country: Taiwan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.40   22.96   23.53   23.49   24.04   24.45 
## -------------------------------------------------------- 
## bmiT$Country: Tajikistan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.32   23.51   23.96   23.89   24.26   24.33 
## -------------------------------------------------------- 
## bmiT$Country: Tanzania
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.27   21.46   21.64   21.71   21.90   22.48 
## -------------------------------------------------------- 
## bmiT$Country: Thailand
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.27   20.95   21.88   21.76   22.55   23.01 
## -------------------------------------------------------- 
## bmiT$Country: Timor-Leste
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.93   20.04   20.32   20.31   20.59   20.62 
## -------------------------------------------------------- 
## bmiT$Country: Togo
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.91   20.99   21.15   21.25   21.47   21.88 
## -------------------------------------------------------- 
## bmiT$Country: Tonga
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   26.38   27.58   28.77   28.74   29.94   31.00 
## -------------------------------------------------------- 
## bmiT$Country: Trinidad and Tobago
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.81   25.12   25.15   25.38   25.59   26.40 
## -------------------------------------------------------- 
## bmiT$Country: Tunisia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.19   22.79   23.46   23.55   24.30   25.16 
## -------------------------------------------------------- 
## bmiT$Country: Turkey
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.66   24.21   25.03   25.06   25.82   26.70 
## -------------------------------------------------------- 
## bmiT$Country: Turkmenistan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.35   24.42   24.51   24.56   24.59   25.25 
## -------------------------------------------------------- 
## bmiT$Country: Uganda
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.27   21.40   21.64   21.71   21.98   22.36 
## -------------------------------------------------------- 
## bmiT$Country: Ukraine
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.72   24.88   24.95   24.96   25.04   25.42 
## -------------------------------------------------------- 
## bmiT$Country: United Arab Emirates
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.88   25.79   26.39   26.46   27.17   28.05 
## -------------------------------------------------------- 
## bmiT$Country: United Kingdom
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.72   25.27   26.02   26.02   26.75   27.39 
## -------------------------------------------------------- 
## bmiT$Country: United States
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25.46   26.26   27.07   27.02   27.81   28.46 
## -------------------------------------------------------- 
## bmiT$Country: Uruguay
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.24   24.67   25.27   25.29   25.93   26.39 
## -------------------------------------------------------- 
## bmiT$Country: Uzbekistan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.56   24.70   24.75   24.79   24.79   25.32 
## -------------------------------------------------------- 
## bmiT$Country: Vanuatu
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.21   24.16   25.06   25.03   25.96   26.79 
## -------------------------------------------------------- 
## bmiT$Country: Venezuela
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.58   25.25   25.97   25.98   26.72   27.44 
## -------------------------------------------------------- 
## bmiT$Country: Vietnam
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.01   19.23   19.59   19.74   20.19   20.92 
## -------------------------------------------------------- 
## bmiT$Country: West Bank and Gaza
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   24.32   24.92   25.61   25.61   26.46   26.58 
## -------------------------------------------------------- 
## bmiT$Country: Yemen, Rep.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.90   23.25   23.56   23.62   23.99   24.44 
## -------------------------------------------------------- 
## bmiT$Country: Zambia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.66   19.85   20.10   20.08   20.20   20.68 
## -------------------------------------------------------- 
## bmiT$Country: Zimbabwe
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.47   21.55   21.59   21.66   21.77   22.03

Evolution of the BMI over time same y scale faceted by country

qplot(x = Year, y = bmi, 
      data = bmiT, group = Country, color=Country,
      ylab = "Body Mass Index",
      geom = 'line') + 
  scale_x_discrete(breaks = seq(1990,2000,5)) +
  facet_wrap(~Country) + 
  theme(axis.text.x = element_text(angle = 60, hjust = 1), legend.position="none")

### Evolution of the BMI over time free y scale faceted by country

qplot(x = Year, y = bmi, 
      data = bmiT, group = Country, color=Country,
      ylab = "Body Mass Index",
      geom = 'line') + 
  scale_x_discrete(breaks = seq(1990,2000,5)) +
  facet_wrap(~Country, scales = "free_y") + 
  theme(axis.text.x = element_text(angle = 60, hjust = 1), legend.position="none")

### Evolution of the BMI over time by country (Same graph)

qplot(x = Year, y = bmi, 
      data = bmiT, group = Country, color=Country,
      ylab = "Body Mass Index",
      geom = 'line') + 
  scale_x_discrete(breaks = seq(1990,2000,5)) +
  theme(axis.text.x = element_text(angle = 60, hjust = 1), legend.position="none")

Problem 3.15 > Exploring Your Friends’ Birthdays

fbf <- read.csv("FBbirth.csv", sep = ",")
fbf <- fbf[1:2]
fbf$Date <- strptime(fbf$Start, "%m/%d")
fbf$Month <- strftime(fbf$Date, "%m")
fbf$Day <- strftime(fbf$Date, "%d")
fbf <- na.omit(fbf)
qplot(x = Month, data = fbf)

by(fbf,fbf$Month,nrow)
## fbf$Month: 01
## [1] 10
## -------------------------------------------------------- 
## fbf$Month: 02
## [1] 9
## -------------------------------------------------------- 
## fbf$Month: 03
## [1] 3
## -------------------------------------------------------- 
## fbf$Month: 04
## [1] 10
## -------------------------------------------------------- 
## fbf$Month: 05
## [1] 7
## -------------------------------------------------------- 
## fbf$Month: 06
## [1] 5
## -------------------------------------------------------- 
## fbf$Month: 07
## [1] 12
## -------------------------------------------------------- 
## fbf$Month: 08
## [1] 6
## -------------------------------------------------------- 
## fbf$Month: 09
## [1] 4
## -------------------------------------------------------- 
## fbf$Month: 10
## [1] 8
## -------------------------------------------------------- 
## fbf$Month: 11
## [1] 4
## -------------------------------------------------------- 
## fbf$Month: 12
## [1] 10